<template>
  <div class="like-view">
    <!-- 页面标题和统计信息 -->
    <div class="page-header">
      <div class="header-content">
        <div class="title-section">
          <div class="title-main">
            <el-icon class="title-icon"><i-ep-heart-filled /></el-icon>
            <h2 class="page-title">我的喜欢</h2>
          </div>
          <p class="page-subtitle">共 {{ total }} 首喜欢的歌曲</p>
          <div class="search-section">
            <el-input
                v-model="searchName"
                placeholder="搜索喜欢的歌曲..."
                clearable
                @clear="handleSearchClear"
                @keyup.enter="handleSearch"
                size="large"
            >
              <template #prefix>
                <el-icon><i-ep-search /></el-icon>
              </template>
            </el-input>
            <el-button
                type="primary"
                @click="handleSearch"
                :loading="searchLoading"
                size="large"
            >
              搜索
            </el-button>
          </div>
        </div>
        <div class="header-actions" v-if="likedSongs.length > 0">
          <el-button
              type="primary"
              :icon="playerState.isPlaying && playerState.currentSong ? 'i-ep-video-pause' : 'i-ep-video-play'"
              @click="togglePlayAll"
              :disabled="likedSongs.length === 0"
              :loading="playAllLoading"
              size="large"
          >
            {{ playerState.isPlaying && playerState.currentSong ? '暂停全部' : '播放全部' }}
          </el-button>
        </div>
      </div>
    </div>

    <!-- 喜欢歌曲列表 -->
    <div class="table-container" v-if="likedSongs.length > 0">
      <el-table
          :data="likedSongs"
          style="width: 100%"
          :row-class-name="tableRowClassName"
          v-loading="loading"
          :empty-text="emptyText"
          @row-dblclick="handleRowDoubleClick"
          class="beautiful-table"
          @sort-change="handleSortChange"
      >
        <!-- 序号列 -->
        <el-table-column
            label="序号"
            align="center"
            width="80"
            type="index"
            fixed="left"
        >
          <template #default="scope">
            <div class="song-index" :class="{ 'playing-index': isCurrentPlaying(scope.row) }">
              {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
              <el-icon v-if="isCurrentPlaying(scope.row)" class="playing-indicator">
                <i-ep-video-play />
              </el-icon>
            </div>
          </template>
        </el-table-column>

        <!-- 歌曲封面 -->
        <el-table-column label="封面" align="center" width="100">
          <template #default="scope">
            <div class="cover-wrapper">
              <el-image
                  :src="scope.row.coverUrl + '?param=80y80'"
                  :alt="scope.row.name"
                  class="cover-img"
                  fit="cover"
                  :preview-src-list="[scope.row.coverUrl]"
                  hide-on-click-modal
                  loading="lazy"
              >
                <template #error>
                  <div class="empty-cover">
                    <el-icon><i-ep-picture /></el-icon>
                  </div>
                </template>
                <template #placeholder>
                  <div class="image-placeholder">
                    <el-icon class="loading-icon"><i-ep-loading /></el-icon>
                  </div>
                </template>
              </el-image>
              <div class="play-overlay" @click.stop="playSong(scope.row, scope.$index)">
                <el-icon :size="24">
                  <i-ep-video-play v-if="!isCurrentPlaying(scope.row) || !playerState.isPlaying" />
                  <i-ep-video-pause v-else />
                </el-icon>
              </div>
            </div>
          </template>
        </el-table-column>

        <!-- 歌曲标题 -->
        <el-table-column
            label="歌曲名称"
            min-width="200"
            prop="name"
            sortable
            show-overflow-tooltip
        >
          <template #default="scope">
            <div class="song-name-cell">
              <span class="song-name" :class="{ 'playing-song': isCurrentPlaying(scope.row) }">
                {{ scope.row.name }}
              </span>
              <el-tag
                  v-if="isCurrentPlaying(scope.row)"
                  size="small"
                  type="danger"
                  class="playing-tag"
                  effect="plain"
              >
                播放中
              </el-tag>
            </div>
          </template>
        </el-table-column>

        <!-- 歌手 -->
        <el-table-column
            prop="artistName"
            label="歌手"
            align="center"
            width="150"
            show-overflow-tooltip
            sortable
        />

        <!-- 专辑 -->
        <el-table-column
            prop="album"
            label="专辑"
            align="center"
            width="200"
            show-overflow-tooltip
            sortable
        />

        <!-- 时长 -->
        <el-table-column
            label="时长"
            align="center"
            width="100"
            prop="duration"
            sortable
        >
          <template #default="scope">
            <span class="duration-text">{{ formatDuration(scope.row.duration) }}</span>
          </template>
        </el-table-column>

        <!-- 操作列 -->
        <el-table-column label="操作" align="center" width="200" fixed="right">
          <template #default="scope">
            <div class="action-buttons">
              <el-button
                  :type="isCurrentPlaying(scope.row) && playerState.isPlaying ? 'warning' : 'primary'"
                  @click="toggleSongPlay(scope.row, scope.$index)"
                  size="small"
                  class="action-btn"
              >
                <el-icon>
                  <VideoPause v-if="isCurrentPlaying(scope.row) && playerState.isPlaying" />
                  <VideoPlay v-else />
                </el-icon>
                {{ isCurrentPlaying(scope.row) && playerState.isPlaying ? '暂停' : '播放' }}
              </el-button>

              <el-button
                  type="danger"
                  @click="cancelLike(scope.row)"
                  :loading="cancelingSongId === scope.row.id"
                  size="small"
                  class="action-btn"
              >
                <el-icon><Delete /></el-icon>
                取消
              </el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
      <div class="pagination-container">
        <el-pagination
            v-model:current-page="currentPage"
            v-model:page-size="pageSize"
            :page-sizes="[5, 10, 20, 50]"
            :background="true"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
        />
      </div>
    </div>

    <!-- 空状态 -->
    <div class="empty-state" v-else-if="!loading">
      <div class="empty-illustration">
        <el-icon class="empty-icon">
          <i-ep-collection />
        </el-icon>
        <div class="empty-wave"></div>
      </div>
      <p class="empty-desc">{{ emptyText }}</p>
      <el-button
          type="primary"
          @click="goToRecommend"
          class="go-recommend-btn"
          size="large"
          :icon="i-ep-opportunity"
      >
        去推荐页发现音乐
      </el-button>
    </div>
  </div>
</template>

<script setup>
import {computed, nextTick, onMounted, onUnmounted, ref, watch} from 'vue'
import {useRouter} from 'vue-router'
import {ElMessage, ElMessageBox} from 'element-plus'
import {debounce} from 'lodash-es'
import {isLogin} from '../utils/auth'
import http from "@/request/http.js"
import {usePlayer} from '@/utils/player.js'
import {Delete, VideoPause, VideoPlay} from '@element-plus/icons-vue'

const router = useRouter()
const {playerState, playSong: playSongInPlayer, togglePlay, setPlaylist, normalizeSongData} = usePlayer()

// 响应式数据
const likedSongs = ref([])
const allLikedSongs = ref([])
const searchName = ref("")
const currentPage = ref(1)
const pageSize = ref(10)
const total = ref(0)
const loading = ref(false)
const searchLoading = ref(false)
const cancelingSongId = ref(null)
const playAllLoading = ref(false)

// 计算属性
const displayedSongs = computed(() => {
  const start = (currentPage.value - 1) * pageSize.value
  const end = start + pageSize.value
  return allLikedSongs.value.slice(start, end)
})

const emptyText = computed(() => {
  if (searchName.value) {
    return `没有找到包含"${searchName.value}"的歌曲`
  }
  return '还没有喜欢的歌曲，去发现喜欢的音乐吧～'
})

// 检查是否为当前播放的歌曲
const isCurrentPlaying = (song) => {
  return playerState.currentSong &&
      (playerState.currentSong.id === song.id ||
          playerState.currentSong.songId === song.id)
}

// 监听收藏更新事件
const handleFavoriteUpdate = (event) => {
  const {type, songId, song} = event.detail
  console.log('收到收藏更新事件:', type, songId, song)

  if (type === 'add') {
    // 标准化歌曲数据
    const normalizedSong = normalizeSongData(song)
    // 检查是否已存在
    const existingIndex = allLikedSongs.value.findIndex(item => item.id === normalizedSong.id)
    if (existingIndex === -1) {
      allLikedSongs.value.unshift(normalizedSong)
      total.value = allLikedSongs.value.length
      currentPage.value = 1 // 添加新歌曲时回到第一页
      updateDisplayedSongs()
      ElMessage.success(`"${normalizedSong.name}" 已添加到喜欢列表`)
    }
  } else if (type === 'remove') {
    // 从喜欢列表移除歌曲
    const index = allLikedSongs.value.findIndex(item => item.id === songId)
    if (index !== -1) {
      allLikedSongs.value.splice(index, 1)
      total.value = allLikedSongs.value.length

      // 如果当前页没有数据了，回到上一页
      if (likedSongs.value.length === 0 && currentPage.value > 1) {
        currentPage.value = currentPage.value - 1
      }

      updateDisplayedSongs()
      ElMessage.success('已从喜欢列表移除')
    }
  }
}

// 生命周期
onMounted(() => {
  if (!isLogin()) {
    router.push('/recommend')
    nextTick(() => {
      window.dispatchEvent(new CustomEvent('showLoginModal'))
    })
  } else {
    getLikeSongs()
  }
  // 添加喜欢状态变更监听
  window.addEventListener('favoriteUpdated', handleFavoriteUpdate)
})

onUnmounted(() => {
  // 移除事件监听
  window.removeEventListener('favoriteUpdated', handleFavoriteUpdate)
})

// 获取喜欢歌曲
const getLikeSongs = async (searchKeyword = '') => {
  loading.value = true
  try {
    const params = {
      pageNum: currentPage.value,
      pageSize: pageSize.value
    }

    // 只有当有搜索关键词时才添加name参数
    if (searchKeyword && searchKeyword.trim()) {
      params.songName = searchKeyword.trim()
    }

    console.log('📤 发送获取喜欢歌曲请求，参数:', params)

    // 使用POST请求获取喜欢歌曲
    const response = await http.post("/favorite/getFavoriteSongs", params)
    console.log('✅ 收到喜欢歌曲响应:', response)

    if (response.code === 0) {
      // 根据实际API响应结构调整
      if (response.data && response.data.items) {
        // 确保歌曲数据格式统一，标准化歌曲数据
        const formattedSongs = response.data.items.map(song => {
          const normalizedSong = normalizeSongData({
            id: song.songId,
            songId: song.songId,
            name: song.songName,
            songName: song.songName,
            artistName: song.artistName,
            album: song.album,
            duration: song.duration,
            likeStatus: song.likeStatus || 1,
            releaseTime: song.releaseTime,
            coverUrl: song.coverUrl,
            audioUrl: song.audioUrl
          })
          return normalizedSong
        })

        allLikedSongs.value = formattedSongs
        total.value = response.data.total
        updateDisplayedSongs()

        console.log('✅ 成功加载喜欢歌曲，数量:', allLikedSongs.value.length)

        // 搜索完成提示
        if (searchKeyword && searchKeyword.trim()) {
          ElMessage.success(`找到 ${allLikedSongs.value.length} 首相关歌曲`)
        } else if (allLikedSongs.value.length > 0) {
          ElMessage.success(`加载了 ${allLikedSongs.value.length} 首喜欢的歌曲`)
        }
      } else {
        console.warn('❓ 响应数据格式不正确:', response.data)
        allLikedSongs.value = []
        total.value = 0

        if (searchKeyword && searchKeyword.trim()) {
          ElMessage.warning(`未找到与"${searchKeyword}"相关的歌曲`)
        } else {
          ElMessage.info('你还没有收藏任何歌曲')
        }
      }
    } else {
      console.error('获取喜欢歌曲失败:', response.message)
      allLikedSongs.value = []
      total.value = 0
      ElMessage.error(response.message || '获取喜欢歌曲失败')
    }
  } catch (error) {
    console.error('❌ 获取喜欢歌曲失败:', error)

    // 详细的错误信息
    if (error.response) {
      console.error('错误响应:', {
        status: error.response.status,
        statusText: error.response.statusText,
        data: error.response.data
      })

      if (error.response.status === 401) {
        ElMessage.error('登录已过期，请重新登录')
        // 触发重新登录
        window.dispatchEvent(new CustomEvent('showLoginModal'))
      } else if (error.response.status === 500) {
        ElMessage.error('服务器内部错误')
      }
    } else {
      ElMessage.error('网络错误，请检查网络连接')
    }

    allLikedSongs.value = []
    total.value = 0

  } finally {
    loading.value = false
    searchLoading.value = false
  }
}

// 搜索处理
const handleSearch = debounce(() => {
  searchLoading.value = true
  currentPage.value = 1
  getLikeSongs(searchName.value)
}, 300)

const handleSearchClear = () => {
  searchName.value = ''
  currentPage.value = 1
  getLikeSongs('')
}

// 排序处理
const handleSortChange = ({prop, order}) => {
  if (!prop) return

  allLikedSongs.value.sort((a, b) => {
    let aVal = a[prop]
    let bVal = b[prop]

    if (prop === 'duration') {
      // 时长排序
      return order === 'ascending' ? aVal - bVal : bVal - aVal
    } else {
      // 字符串排序
      if (order === 'ascending') {
        return aVal.localeCompare(bVal)
      } else {
        return bVal.localeCompare(aVal)
      }
    }
  })

  updateDisplayedSongs()
}

// 更新显示歌曲
const updateDisplayedSongs = () => {
  likedSongs.value = displayedSongs.value
}

// 分页处理
const handleSizeChange = (newSize) => {
  pageSize.value = newSize
  currentPage.value = 1
  getLikeSongs(searchName.value)
}

const handleCurrentChange = (newPage) => {
  currentPage.value = newPage
  getLikeSongs(searchName.value)
}

// 表格行双击事件 - 使用全局播放器
const handleRowDoubleClick = (row, column, event) => {
  const index = likedSongs.value.findIndex(song => song.id === row.id)
  if (index !== -1) {
    playSong(row, index)
  }
}

// 表格行样式
const tableRowClassName = ({rowIndex}) => {
  return rowIndex % 2 === 1 ? 'even-row' : ''
}

// 格式化时长
const formatDuration = (seconds) => {
  if (!seconds || isNaN(seconds)) return '0:00'

  // 确保seconds是数字类型
  const secs = typeof seconds === 'string' ? parseFloat(seconds) : seconds
  if (isNaN(secs)) return '0:00'

  const minutes = Math.floor(secs / 60)
  const remainingSeconds = Math.floor(secs % 60)
  return `${minutes}:${remainingSeconds.toString().padStart(2, '0')}`
}

// 播放歌曲 - 使用全局播放器
const playSong = (song, index) => {
  console.log('播放歌曲', song, '索引:', index, '播放列表数量:', likedSongs.value.length)

  // 设置当前页面的歌曲列表为播放列表
  setPlaylist(likedSongs.value, index)

  // 播放指定歌曲
  playSongInPlayer(song, likedSongs.value, index)
  ElMessage.success(`开始播放: ${song.name} - ${song.artistName}`)
}

// 切换歌曲播放/暂停
const toggleSongPlay = (song, index) => {
  if (isCurrentPlaying(song)) {
    // 同一首歌，切换播放状态
    togglePlay()
  } else {
    // 不同歌曲，开始播放新歌曲
    playSong(song, index)
  }
}

// 播放全部
const togglePlayAll = async () => {
  if (likedSongs.value.length === 0) return

  playAllLoading.value = true
  try {
    if (playerState.currentSong && playerState.isPlaying) {
      // 如果正在播放，暂停
      togglePlay()
    } else {
      // 播放第一首歌曲
      playSong(likedSongs.value[0], 0)
    }
  } finally {
    playAllLoading.value = false
  }
}

// 取消喜欢
const cancelLike = async (song) => {
  try {
    await ElMessageBox.confirm(
        `确定要取消喜欢《${song.name}》吗？`,
        '提示',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          confirmButtonClass: 'confirm-danger-btn'
        }
    )

    cancelingSongId.value = song.id

    // 调用取消喜欢API
    try {
      const response = await http.delete(`/favorite/cancelCollectSong?songId=${song.id}`)
      if (response.code === 0) {
        // 从列表中移除歌曲
        const allIndex = allLikedSongs.value.findIndex(item => item.id === song.id)
        if (allIndex !== -1) {
          allLikedSongs.value.splice(allIndex, 1)
          total.value = allLikedSongs.value.length

          // 如果当前页没有数据了，回到上一页
          if (likedSongs.value.length === 0 && currentPage.value > 1) {
            currentPage.value = currentPage.value - 1
          }

          updateDisplayedSongs()

          ElMessage.success('已取消喜欢')

          // 通知曲库页面更新喜欢状态
          window.dispatchEvent(new CustomEvent('favoriteUpdated', {
            detail: {type: 'remove', songId: song.id, song: song}
          }))
        }
      } else {
        ElMessage.error(response.message || '取消喜欢失败')
      }
    } catch (error) {
      console.error('取消喜欢API调用失败:', error)
      ElMessage.error('取消喜欢失败，请重试')
    }
  } catch (error) {
    if (error !== 'cancel') {
      console.error('取消喜欢失败:', error)
      ElMessage.error('取消喜欢失败')
    }
  } finally {
    cancelingSongId.value = null
  }
}

// 跳转到推荐页
const goToRecommend = () => {
  router.push('/recommend')
}

// 监听搜索词变化
watch(searchName, (newVal) => {
  if (newVal === '') {
    handleSearchClear()
  }
})
</script>

<style scoped>
.like-view {
  padding: 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  min-height: 100vh;
  box-sizing: border-box;
  padding-bottom: 80px;
}

.page-header {
  margin-bottom: 24px;
  background: white;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.title-section {
  flex: 1;
}

.title-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  background: linear-gradient(135deg, #ef4444, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-icon {
  color: #ef4444;
  font-size: 36px;
  filter: drop-shadow(0 4px 8px rgba(239, 68, 68, 0.2));
}

.page-subtitle {
  font-size: 16px;
  color: #64748b;
  margin: 8px 0 24px 0;
  font-weight: 500;
}

.search-section {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 480px;
}

.search-section .el-input {
  flex: 1;
}

.search-section .el-input :deep(.el-input__wrapper) {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.search-section .el-input :deep(.el-input__wrapper:hover),
.search-section .el-input :deep(.el-input__wrapper.is-focus) {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

/* 表格样式 */
.table-container {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.beautiful-table {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #f1f5f9;
}

.beautiful-table :deep(.el-table__header) {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.beautiful-table :deep(.el-table th) {
  background: transparent;
  color: #475569;
  font-weight: 600;
  border-bottom: 2px solid #e2e8f0;
  font-size: 14px;
  height: 56px;
}

.beautiful-table :deep(.el-table td) {
  border-bottom: 1px solid #f1f5f9;
  padding: 16px 0;
}

/* 序号列样式 */
.song-index {
  font-weight: 500;
  color: #64748b;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
}

.playing-index {
  color: #ef4444;
  font-weight: 700;
}

.playing-indicator {
  color: #ef4444;
  animation: pulse 2s infinite;
}

/* 封面样式优化 */
.cover-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.cover-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  transition: all 0.3s ease;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(249, 115, 22, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 10px;
}

.cover-wrapper:hover .play-overlay {
  opacity: 1;
}

.cover-wrapper:hover .cover-img {
  transform: scale(1.08);
}

/* 歌曲名称样式 */
.song-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.song-name {
  font-weight: 500;
  color: #1e293b;
  transition: color 0.3s ease;
  font-size: 14px;
}

.playing-song {
  color: #ef4444;
  font-weight: 600;
}

.playing-tag {
  margin-left: 8px;
  border: none;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
}

.duration-text {
  color: #64748b;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 13px;
  font-weight: 500;
}

/* 操作按钮 */
.action-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 表格行样式 */
:deep(.even-row) {
  background-color: #fafbfc;
}

:deep(.el-table .el-table__row:hover) {
  background-color: #f8fafc;
  transform: translateY(-1px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

:deep(.el-table .el-table__row) {
  cursor: pointer;
  transition: all 0.3s ease;
}

/* 分页样式 */
.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 32px;
  padding: 24px 0 0;
}

.pagination-container :deep(.el-pagination) {
  --el-pagination-bg-color: transparent;
}

/* 空状态样式 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  color: #64748b;
  background: white;
  border-radius: 24px;
  margin-top: 24px;
  padding: 80px 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  text-align: center;
  backdrop-filter: blur(10px);
}

.empty-illustration {
  position: relative;
  margin-bottom: 40px;
}

.empty-icon {
  font-size: 140px;
  color: #cbd5e1;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
}

.empty-wave {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 6px;
  background: linear-gradient(90deg, transparent, #3b82f6, transparent);
  border-radius: 50%;
  animation: wave 2s ease-in-out infinite;
  filter: blur(1px);
}

.empty-desc {
  font-size: 20px;
  margin-bottom: 40px;
  color: #475569;
  font-weight: 500;
  line-height: 1.6;
}

.go-recommend-btn {
  padding: 14px 36px;
  border-radius: 25px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.go-recommend-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* 动画 */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes wave {
  0%, 100% {
    opacity: 0.6;
    transform: translateX(-50%) scale(0.9);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.1);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .like-view {
    padding: 16px;
    padding-bottom: 70px;
  }

  .page-header {
    padding: 24px;
  }

  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .title-main {
    gap: 12px;
  }

  .page-title {
    font-size: 28px;
  }

  .title-icon {
    font-size: 32px;
  }

  .search-section {
    max-width: none;
  }

  .table-container {
    padding: 16px;
    overflow-x: auto;
  }

  .cover-img {
    width: 56px;
    height: 56px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 6px;
  }

  .empty-state {
    padding: 60px 24px;
  }

  .empty-icon {
    font-size: 100px;
  }

  .empty-desc {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 24px;
  }

  .empty-desc {
    font-size: 16px;
  }

  .go-recommend-btn {
    padding: 12px 28px;
    font-size: 14px;
  }

  .search-section {
    flex-direction: column;
    align-items: stretch;
  }

  .search-section .el-button {
    align-self: flex-end;
    margin-top: 12px;
  }
}
</style>